define [
  'controllers/base/controller'
  'views/user/login_view'
  'views/user/index_view'
  'views/user/form_view'
  'models/user_model'
  'collections/user_collection'
  'daos/access_dao'
  'daos/user_dao'
  'lib/dao_factory'
], () ->

  'use strict'

  # Imports
  # =============================================================

  Controller                  = require 'controllers/base/controller'
  UserModel                   = require 'models/user_model'
  UserCollection              = require 'collections/user_collection'
  LoginView                   = require 'views/user/login_view'
  DaoFactory                  = require 'lib/dao_factory'
  IndexView                   = require 'views/user/index_view'
  FormView                    = require 'views/user/form_view'

  # DAO's
  # =============================================================

  AccessDAO      = DaoFactory.getDAOByName 'access_dao'
  UserDAO        = DaoFactory.getDAOByName 'user_dao'

  class MainController extends Controller

    # Actions
    # =============================================================

    beforeAction: ->
      super
      @model = new UserModel

    index: ->
      console.log @globals.userData

    _setupHistoryBack: ->
      @view.on 'model:saved', =>
        @publishEvent 'feedback:success', 'Usuário salvo com sucesso'
        @redirectTo url: 'usuario'
